{include file='public/meta'}
<title>添加管理员</title>
{css href='/static/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css'}
</head>
<style type="text/css">
  .row{margin-right:40px;}
</style>
<body>
<link href="/static/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="cl pd-20">
	<form action="" method="post" class="form form-horizontal" id="form-article-add" enctype="multipart/form-data">
    <!-- 管理员姓名 -->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>管理员姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="输入管理员姓名" name="uname" value="" required>
			</div>
		</div>
    <!-- 密码 -->
    <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>密码：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <input type="password" class="input-text" placeholder="请输入密码" name="pwd" value="" required>
      </div>
    </div>
    <!-- 确认密码 -->
    <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>确认密码：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <input type="password" class="input-text" placeholder="请确认密码" name="pwd_confirm" value="" required>
      </div>
    </div>
    <!-- 联系方式 -->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系方式：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="" name="utel" required minlength=11 maxlength=11>
			</div>
		</div>
    <!-- 区域 -->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>区域：</label>
				<select name="area" class="select" style="height:35px;width:295px;margin-left:15px">
          <option value="">请选择区/县</option>
          {volist name="data_area" id="vo"}
          <option value="{$vo.id}">{$vo.name}</option>
          {/volist}
        </select>
		</div>
    <!-- 职位 -->
    <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>职位：</label>
      <div class="formControls col-xs-8 col-sm-9 skin-minimal">
        {volist name="group" id="vo"}
        <div class="radio-box">
            <input name="gid" type="radio" id="gid-{$vo.gid}" value="{$vo.gid}" required>
            <label for="gid-{$vo.gid}">{$vo.gname}</label>
        </div>
        {/volist}
      </div>
    </div>
    <!-- 缩略图 -->
		<div class="row cl">
          <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>缩略图：</label>
          <div class="formControls col-xs-8 col-sm-9">
              <div class="uploader-thum-container">
                  <input type="file" name="thumb[]" class="input-text" required>
              </div>
          </div>
      </div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-primary radius" id="submit" type="submit"><i class="Hui-iconfont">&#xe632;</i> 注册</button>
			</div>
		</div>
	</form>
</div>
{include file='public/footer'}
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
  <script type="text/javascript" src="/static/lib/webuploader/0.1.5/webuploader.min.js"></script> 
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.config.js"></script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript">
  $().ready(function(){
  	$('form').validate({
      rules:{
        pwd_confirm:{
          equalTo:'input[name=pwd]'
        }
      },
  		messages:{
        gid:{
          required:'必填字段',
        },
        pwd_confirm:{
          equalTo:'密码输入不一致',
        },
      },
  		submitHandler:function(form){
  			$(form).ajaxSubmit({
  				type:'post',
  				url:'{:url('admin/member/do_add')}',
  				dataType:'text',
  				success:function(res){
            res = eval('('+res+')');
            console.log(res.msg);
            if(res.msg == '成功'){
              layer.msg('添加成功!',{icon:1,time:2000},function(){
                var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);  
              });
              // location.reload();
            }else{
              layer.msg(res.msg+'!',{icon:1,time:2000});
            }
            // layer_close();
  				}
  			})
  		}
  	});
  })

  $(function(){
  	$('.skin-minimal input').iCheck({
  		checkboxClass: 'icheckbox-blue',
  		radioClass: 'iradio-blue',
  		increaseArea: '20%'
  	});
  });

</script>
</body>
</html>